﻿<UserControl x:Class="MTGenome.Views.CardCollectionView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:caliburn="http://www.caliburnproject.org"
             xmlns:ui="clr-namespace:MTGenome.UI"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             caliburn:Message.Attach="[Event Loaded] = [Action Loaded]">
    <Grid>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <!--
        <TextBox x:Name="CollectionSearchTextBox" Grid.Row="0" />-->

        <DataGrid ItemsSource="{Binding Cards}" 
                  AutoGenerateColumns="False" 
                  Height="Auto" 
                  AlternatingRowBackground="#E9ECFA"
                  Width="Auto" 
                  Grid.Row="1" 
                  GridLinesVisibility="None" 
                  IsReadOnly="True" 
                  SelectedItem="{Binding SelectedCard}" 
                  caliburn:Message.Attach="[Event SelectionChanged] = [Action CardSelected]">
            <DataGrid.Columns>
                <DataGridTextColumn Header="Name" Binding="{Binding Name}" />
                <DataGridTextColumn Header="Mana Cost" Binding="{Binding ManaCost}" />
                <DataGridTextColumn Header="Type" Binding="{Binding Type}" />
                <DataGridTextColumn Header="Rarity" Binding="{Binding Rarity}" />
                <DataGridTextColumn Header="Expansion" Binding="{Binding Expansion}" />
                <DataGridTextColumn Header="Color" Width="*" Binding="{Binding Color}" />
            </DataGrid.Columns>
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <ContextMenu.ItemsSource>
                    <CompositeCollection>
                            <MenuItem Header="Add 1 to Deck" caliburn:Message.Attach="AddOneCardToDeck" />
                            <MenuItem Header="Add 4 to Deck" caliburn:Message.Attach="AddFourCardsToDeck" />
                            <MenuItem Header="Add 1 to Sideboard" caliburn:Message.Attach="AddOneCardToSideBoard" />
                            <MenuItem Header="Add 4 to Sideboard" caliburn:Message.Attach="AddFourCardsToSideBoard" />
                    </CompositeCollection>
                    </ContextMenu.ItemsSource>
                </ContextMenu>
            </DataGrid.ContextMenu>
        </DataGrid>

    </Grid>
</UserControl>
